package com.tangyuan.user.controller;


import com.tangyuan.common.result.Result;
import com.tangyuan.model.User;
import com.tangyuan.user.service.UserPublishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@RestController
@RequestMapping("/user/myinfo")
public class UserMyInfoController {
    @Autowired
    UserPublishService userPublishService;

    //登录时信息展示
    @GetMapping("/getmyinfomession")
    public Result getMyInfoMission(@RequestParam Long userId) {
        return userPublishService.getMyInfoMission(userId);
    }

    //我的关注
    @GetMapping("/getMyconcern")
    public Result getMyConcern(@RequestHeader(name = "userId", required = false) Long userId,
                               @RequestParam Integer pageNum,
                               @RequestParam Integer pageSize) {
        return userPublishService.getMyConcern(userId, pageNum, pageSize);
    }


    //我的关注 设置备注名
    @GetMapping("/setMyconcernMark")
    public Result setMyConcernMark(@RequestHeader(name = "userId", required = false) Long userId,
                                   @RequestParam Long concernedUserId,
                                   @RequestParam String remark) {
        return userPublishService.setMyConcernMark(userId, concernedUserId, remark);
    }

    //我的关注 设置特别关注 取消特别关注
    @GetMapping("/setMyspecialconcern")
    public Result setMySpecialConcern(@RequestHeader(name = "userId", required = false) Long userId,
                                      @RequestParam Long concernedUserId
    ) {
        return userPublishService.setMySpecialConcern(userId, concernedUserId);
    }
    //搜索我的关注

    @GetMapping("/searchMyconcern")
    public Result searchMyConcern(@RequestHeader(name = "userId", required = false) Long userId,
                                  @RequestParam Integer pageNum,
                                  @RequestParam Integer pageSize,
                                  @RequestParam String name) {
        return userPublishService.searchMyConcern(userId, pageNum, pageSize, name);
    }


    //我的粉丝
    @GetMapping("/getMyconcerned")
    public Result getMyConcerned(@RequestHeader(name = "userId", required = false) Long userId,
                                 @RequestParam Integer pageNum,
                                 @RequestParam Integer pageSize) {
        return userPublishService.getMyConcerned(userId, pageNum, pageSize);
    }

    //移除我的粉丝
    @GetMapping("/removeMyconcerned")
    public Result removeMyConcerned(@RequestHeader(name = "userId", required = false) Long userId, @RequestParam Long concernUserId) {
        return userPublishService.removeMyConcerned(userId, concernUserId);
    }

    //todo
    //搜索我的粉丝
    @GetMapping("/searchMyconcerned")
    public Result searchMyConcerned(@RequestHeader(name = "userId", required = false) Long userId,
                                    @RequestParam Integer pageNum,
                                    @RequestParam Integer pageSize,
                                    @RequestParam String name) {
        return userPublishService.searchMyConcerned(userId, pageNum, pageSize, name);
    }


    //我的获赞
    @GetMapping("/getMythump")
    public Result getMyThump(@RequestHeader(name = "userId", required = false) Long userId) {
        return userPublishService.getMyThump(userId);
    }

    //我的钱包 唐币
    @GetMapping("/getMypurse")
    public Result getMyPurse(@RequestHeader(name = "userId", required = false) Long userId) {
        return userPublishService.getMyPurse(userId);
    }

    //我的充值记录
    @GetMapping("/getMyRecharge")
    public Result getMyRecharge(@RequestHeader(name = "userId", required = false) Long userId,
                                @RequestParam Integer pageNum,
                                @RequestParam Integer pageSize) {
        return userPublishService.getMyRecharge(userId, pageNum, pageSize);
    }

    //我的唐币明细
    @GetMapping("/getMyCurrencyDetails")
    public Result getMyCurrencyDetails(@RequestHeader(name = "userId", required = false) Long userId,
                                @RequestParam Integer pageNum,
                                @RequestParam Integer pageSize) {
        return userPublishService.getMyCurrencyDetails(userId, pageNum, pageSize);
    }

    //我点赞的视频
    @GetMapping("/getMyTrumpVideo")
    public Result getMyTrumpVideo(@RequestHeader(name = "userId", required = false) Long userId,
                                  @RequestParam Integer pageNum,
                                  @RequestParam Integer pageSize) {
        return userPublishService.getMyTrumpVideo(userId, pageNum, pageSize);
    }

    /**
     * 我点赞的百家
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/getMyTrumpArticle")
    public Result getMyTrumpArticle(@RequestHeader(name = "userId", required = false) Long userId,
                                    @RequestParam Integer pageNum,
                                    @RequestParam Integer pageSize) {
         return userPublishService.getMyTrumpArticle(userId,pageNum,pageSize);
    }

    //我收藏的视频
    @GetMapping("/getMyCollectVideo")
    public Result getMyCollectVideo(@RequestHeader(name = "userId", required = false) Long userId,
                                    @RequestParam Integer pageNum,
                                    @RequestParam Integer pageSize) {
        return userPublishService.getMyCollectVideo(userId, pageNum, pageSize);
    }

    //我收藏的文章
    @GetMapping("/getMyCollectArticle")
    public Result getMyCollectArticle(@RequestHeader(name = "userId", required = false) Long userId,
                                    @RequestParam Integer pageNum,
                                    @RequestParam Integer pageSize) {
        return userPublishService.getMyCollectArticle(userId, pageNum, pageSize);
    }


    //充值唐币
    @GetMapping("/recharge")
    public Result recharge(@RequestHeader(name = "userId", required = false) Long userId,
                                @RequestParam Integer payType,
                                @RequestParam BigDecimal amount) {
        return userPublishService.recharge(userId, payType, amount);
    }
}
